package com.ruoyi.web.controller.house;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.cost.service.IHouseDoorCostService;
import com.ruoyi.door.domain.HouseDoorT;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 户资金修改Controller
 * 
 * @author ruoyi
 * @date 2023-04-26
 */
@RestController
@RequestMapping("/house/cost")
public class HouseDoorCostController extends BaseController
{
    @Autowired
    private IHouseDoorCostService houseDoorCostService;

    /**
     * 查询户管理列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HouseDoorT houseDoorT)
    {
        startPage();
        List<HouseDoorT> list = houseDoorCostService.selectHouseDoorTList(houseDoorT);
        return getDataTable(list);
    }

    /**
     * 获取户管理详细信息
     */
    @GetMapping(value = "/{doorId}")
    public AjaxResult getInfo(@PathVariable("doorId") Long doorId)
    {
        return AjaxResult.success(houseDoorCostService.selectHouseDoorCostTByDoorId(doorId));
    }
    /**
     * 新增户资金修改
     */
    @Log(title = "户资金修改", businessType = BusinessType.INSERT)
    @PutMapping
    public AjaxResult edit(@RequestBody HouseDoorT houseDoorT)
    {
        return toAjax(houseDoorCostService.updateHouseDoorT(houseDoorT));
    }
}
